import { createRouter, createWebHashHistory } from "vue-router";
import Index from "@/views/index/index.vue";


const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "index",
      redirect: "/film/hoting",
      component: Index,
      children: [
        {
          path: "film",
          name: "film",
          component: () => import("@/views/index/film.vue"),
          meta: {
            title: "电影"
          },
          children: [
            {

              path: 'hoting',
              name: 'hoting',
              component: () => import('@/views/hoting/index.vue'),
            },
            {
              path: 'comingsoon',
              name: 'comingsoon',
              component: () => import('@/views/comingsoon/index.vue')
            },
          ]
        },


        {
          path: "cimena",
          name: "cimena",
          component: () => import("@/views/index/cimena.vue"),
          meta: {
            title: "影院"
          }
        },
        {
          path: "info",
          name: "info",
          component: () => import("@/views/index/info.vue"),
          meta: {
            title: "资讯"
          }
        },
        {
          path: "mine",
          name: "mine",
          component: () => import("@/views/index/mine.vue"),
          meta: {
            title: "我的"
          }
        },

      ]
    },

    {
      path: "/film/:id",
      name: "detail",
      component: () => import("@/views/detail/index.vue"),
      meta: {
        title: "电影详情页",
      },
    },
    {
      path: "/city",
      name: "city",
      component: () => import("@/views/city/index.vue"),
      meta: {
        title: "城市选择",
      },
    },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/login/index.vue")
    },

    {
      path: "/:pathMatch(.*)*",
      name: "NotFound",
      component: () => import("@/views/not-found/index.vue"),
      meta: {
        title: "404"
      }
    },
  ],
});

export default router;
